<template>
    <div>
        <el-form :inline="true">
            <el-form-item label="科目">
                <el-select v-model="subject">
                    <el-option label="全部" value=""></el-option>
                    <el-option v-for="(subject,index) in ['语文','数学','英语']" :key="index" :label="subject" :value="subject"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="get_paper_list">查询</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="paper_list">
            <el-table-column prop="paperSubject" label="科目"></el-table-column>
            <el-table-column prop="paperName" label="试卷名"></el-table-column>
            <el-table-column prop="paperTotal" label="总分"></el-table-column>
            <el-table-column prop="examTime" label="考试时间"></el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button @click="paper_delete(scope.row.paperId)" type="warning">删除</el-button>
                    <el-button @click="paper_edit(scope.row.paperId)">修改</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
import {paper_get} from "@/api/paper"

export default {
    name: "AdminLayout",
    data() {
        return {
            subject:'',
            paper_list: []
        }
    },
    methods: {
        get_paper_list(){
            paper_get(this.subject).then(res=>{
                this.paper_list = res.data
            }).catch(error=>{
                console.log(error)
            })
        }
    },
    mounted(){
        this.get_paper_list()
    },
};
</script>
<style scoped>
</style>